﻿$(document).ready(function() {
    JSUtility.url = '../Handler/AjaxHandle.ashx';
    JSUtility.param = { AssemblyName: "OA.Bll.Personnel", ClassName: "OA.Bll.Personnel.PassportPresenter", Method: "Search", Options: {} };
    top.autoResize({ dataGrid: '#Grid', callback: InitPassportlist, par: {}, method: 'Paged' });
    $('#btnSubmit,#btnCancel').linkbutton();

    JSUtility.window_edit_form = $("#PassportWin").find("form");
    JSUtility.window_edit = $("#PassportWin");
    $("#btnAdd").bind("click", JSUtility.add);
    $("#btnDel").click(JSUtility.del);
    $("#btnEdit").bind("click", JSUtility.update);
//    $("#btnRefersh").click(function() {
//        $('#Grid').datagrid('reload');
//    });
    $("#btnSubmit").click(function() {
        JSUtility.param.Options["EmployeeId"] = $("#EmployeeId").combotree('getValue');
        JSUtility.save();
    });
    $('#btnCancel').click(JSUtility.close);
});

function InitPassportlist(op, method, size) {
    var p = JSUtility.param;
    JSUtility.grid = $('#Grid').datagrid({
        width: size.width,
        height: size.height,
        pageSize: Math.round(size.height / 25),
        pageList: [Math.round(size.height / 25)],
        striped: true,
        queryParams: { "json": $.toJSON(p) },
        url: JSUtility.url,
        singleselect: true
    });
}

